<template>
    <view class="smart-page">
        <!--页面标题头begin-->
        <view class="smart-page-head">
            <view class="smart-page-head-title">audio音频</view>
        </view>
        <!--页面标题头end-->
        <view>
            <button type="primary" @click="play()">播放</button>
            <audio id="myaudio" name="我爱你,祖国" controls="true" poster="../../../static/logo.png"
                author="贝多芬" src="/pages/components/audio/music.mp3"></audio>
        </view>
    </view>
</template>
<script>
export default {
    data() {
        return {
        }
    },
    onReady: function(){
        this.audioContext = uni.createAudioContext("myaudio");
    },
    methods: {
        play(){
            this.audioContext.play();
        },
        pause(){
            this.audioContext.pause();
        }
    }
}
</script>

<style>

</style>
